<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>对象字面量增强写法</title>
</head>
<body>

<p>
    具体代码查看控制台
</p>

</body>

<script>
    // ES5的写法
    const a = '1';
    const b = '2';
    const c = '3';
    const obj = {
        a: a,
        b: b,
        c: c
    };
    console.log(obj);

    // ES6的写法
    const obj2 = {
        a,
        b,
        c
    };
    console.log(obj2);


    // ES5的写法
    const action = {
        run: function () {
            console.log('run');
        },
        eat: function () {
            console.log('eat');
        }
    };

    // ES6的写法
    const action2 = {
        run() {
            console.log('run');
        },
        eat() {
            console.log('eat');
        }
    }

</script>
</html>